//
//  BBMVCTester.m
//  BattleFrontierV3
//
//  Created by Eric on 12/24/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "BBMVCTester.h"
#import "BBButton.h"

@implementation BBMVCTestAction

-(id)doAction:(id)param{
    NSLog(@"BBMVCTestAction:doAction:%@-%@", self, param);
    return param;
}

@end

@implementation BBMVCTester
+(CCScene *) scene
{
	CCScene *scene = [CCScene node];	
	BBMVCTester *layer = [BBMVCTester node];
	[scene addChild: layer];
	return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
    BBPackFunc *func = [BBPackFunc action:self func:@selector(test)];
    BBButton* btn = [BBButton buttonFile:@"Icon.png" selected:@"Icon.png" disabled:@"Icon.png" pack:func];
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if( (self=[super init])) {
        CGSize size = [[CCDirector sharedDirector] winSize];
        btn.position =  ccp( size.width /2 , size.height/2 );
        [self addChild: btn];
	}
	return self;
}
-(void)test{
    NSLog(@"BBMVCTester:test");
    [[BBMVCDispatcher dispatcher] requestAsyn:@"test" param:@"testParam" callbackTgt:self callback:@selector(testCallback:)];
}
-(void)testCallback:(id)result{
    NSLog(@"BBMVCTester:testCallback:%@",result);
}
@end
